const timeElement = document.getElementById('nowtime');

function updateTime() {
  const now = new Date();
  const year = now.getFullYear();
  const month = String(now.getMonth() + 1).padStart(2, '0');
  const day = String(now.getDate()).padStart(2, '0');
  const hours = String(now.getHours()).padStart(2, '0');
  const minutes = String(now.getMinutes()).padStart(2, '0');
  const seconds = String(now.getSeconds()).padStart(2, '0');
  const weekday = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][now.getDay()];

  timeElement.textContent = `${year}-${month}-${day} ${weekday} ${hours}:${minutes}:${seconds}`;
}

updateTime(); // 初始化显示时间

setInterval(updateTime, 1000); // 每隔 1000 毫秒更新一次时间
